package com.lib.framework.widget

import android.view.View
import android.widget.EditText
import android.widget.ImageView
import androidx.databinding.BindingAdapter

/**
 * databinding 的 adapter
 *
 * @author keanbin
 */
class BindingAdapterUtil {

    companion object {

        @BindingAdapter("android:hint")
        @JvmStatic
        fun setHintText(editText: EditText, text: String) {
            editText.hint = text
        }

        @BindingAdapter("android:background")
        @JvmStatic
        fun setBackground(view: View, resId: Int) {
            view.setBackgroundResource(resId)
        }

        @BindingAdapter("android:src")
        @JvmStatic
        fun setImageResource(imageView: ImageView, resId: Int) {
            imageView.setImageResource(resId)
        }
    }
}